﻿using OpenNETCF.MTConnect;
using Okuma.CLDATAPI.DataAPI;

namespace Okuma
{
    public class CurrentAlarm : HostedComponentBase
    {
        private object m_syncRoot = new object();
        private CCurrentAlarm m_alarm;

        internal CCurrentAlarm Alarm 
        {
            get 
            {
                lock (m_syncRoot)
                {
                    return m_alarm;
                }
            }
            set 
            {
                lock (m_syncRoot)
                {
                    m_alarm = value;
                }
            }
        }

        public override string Name
        {
            get { return "CurrentAlarm"; }
        }

        [EventDataItem]
        public int AlarmNumber
        {
            get
            {
                return Alarm.AlarmNumber;
            }
        }

        [EventDataItem]
        public string AlarmCode
        {
            get
            {
                return Alarm.AlarmCode;
            }
        }

        [EventDataItem]
        public string AlarmLevel
        {
            get
            {
                return Alarm.AlarmLevel.ToString();
            }
        }

        [EventDataItem]
        public string AlarmMessage
        {
            get
            {
                return Alarm.AlarmMessage;
            }
        }
    }
}
